Skip to content

Conversation

jasnell
Copy link
Contributor

@jasnell jasnell commented Oct 11, 2025

See the code comments for details.

One challenge/question: it's not clear that this function is actually being tested with pnpm run test... to check I added a throw new Error('boom') and ran pnpm run test and everything still passed.

/cc @vicb @anonrig

Copy link

changeset-bot bot commented Oct 11, 2025

🦋 Changeset detected

Latest commit: e03b871

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Oct 11, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/@opennextjs/aws@1013

commit: 4666a19

See the code comments for details.
@jasnell jasnell force-pushed the jasnell/avoid-copy-buffers-in-internalwrite branch from a428ff3 to a7173ff Compare October 11, 2025 15:02
@vicb vicb changed the title Avoid unnecessary buffer copy in internalWrite perf: avoid unnecessary buffer copy in internalWrite Oct 11, 2025
@vicb
Copy link
Contributor

vicb commented Oct 11, 2025

See the code comments for details.

One challenge/question: it's not clear that this function is actually being tested with pnpm run test... to check I added a throw new Error('boom') and ran pnpm run test and everything still passed.

/cc @vicb @anonrig

See the README to run the e2e tests

vicb
vicb previously requested changes Oct 11, 2025
Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add more info about "buffer" encoding.

It does not seem to be supported on Node 22.16.0 (see inline comment)

@vicb
Copy link
Contributor

vicb commented Oct 12, 2025

Thanks for the additional details @jasnell.

IIUC the first change makes sense to avoid having to copy the buffer when it is already a buffer.

Still not clear about this.push(buffer, "buffer");:

  • the doc explicitely says it is not allowed
  • it does not seem to make any difference in the code

Can you measure any perf difference for that second change?

@vicb vicb self-requested a review October 13, 2025 17:05
@vicb vicb dismissed their stale review October 13, 2025 17:06

'buffer' is a legit encoding value in _transform.
Does not seem to affect push and documented as not supported.

@vicb vicb merged commit 3e0126a into opennextjs:main Oct 15, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants